package cn.jilian.entity;

import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name="bt_menu",uniqueConstraints={@UniqueConstraint(name="unitUniqueByText",columnNames= {"fid","text"})})
@DiscriminatorColumn(name="meta",discriminatorType=DiscriminatorType.INTEGER)
public class Menu extends AbstractEntity{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -7404282399955854382L;

	public static final Integer RANK=210317;
	
	public static final Long ROOTID=RANK.longValue();
	

	/**
	 * 菜单页面
	 * */ 
	public static final String MENUPAGE_META="38616";

	/**
	 * 菜单分组
	 * */ 
	public static final String MENUGROUP_META="38617";

	/**
	 * 菜单操作
	 * */ 
	public static final String MENU_ACT_META="39610";
	
	public static final Map<Long,Class<? extends Menu>> MetaClassMap=new ConcurrentHashMap<>();
	
	static {
		MetaClassMap.put(Long.parseLong(MENUPAGE_META), MenuPage.class);
		MetaClassMap.put(Long.parseLong(MENUGROUP_META), MenuGroup.class);
		MetaClassMap.put(Long.parseLong(MENU_ACT_META), MenuAct.class);
	}

	public Menu() {
		this.setRank(RANK);
	}
	
	
	@Column(name="name")
	private String name;
	
	@Column(name="code")
	private String url;
	
	@Column(name="text")
	private String text;
	
	@Column(name="act")
	private Integer act;
	public Integer getAct() {
		return act;
	}

	public void setAct(Integer act) {
		this.act = act;
	}
	
	@Column(name="icon")
	private String iconCls;
	
	@Column(name="flag")
	private Integer flag=1;
	
	@Column(name="tims")
	private Date tims;
	
	

	

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getIconCls() {
		return iconCls;
	}

	public void setIconCls(String iconCls) {
		this.iconCls = iconCls;
	}


	public Integer getFlag() {
		return flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}

	public Date getTims() {
		return tims;
	}

	public void setTims(Date tims) {
		this.tims = tims;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}


}
